home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 2.iso / dist / fw_gimp-print.idb / usr / freeware / info / gimpprint.info-4.z / gimpprint.info-4
Text File  |  2002-10-07  |  45KB  |  1,152 lines

  1. This is gimpprint.info, produced by makeinfo version 4.0 from
  2. gimpprint.texi.
  3.  
  4. INFO-DIR-SECTION Libraries
  5. START-INFO-DIR-ENTRY
  6. * GIMP-Print: (gimpprint).      print plugin for the GIMP, and printing library
  7. END-INFO-DIR-ENTRY
  8.  
  9.    This file documents the gimpprint library and associated programs
  10. used for high quality printing.
  11.  
  12.    Copyright (C) 2001 Michael Sweet (<mike@easysw.com>) and Robert
  13. Krawitz (<rlk@alum.mit.edu>)
  14.  
  15.    Permission is granted to make and distribute verbatim copies of this
  16. manual provided the copyright notice and this permission notice are
  17. preserved on all copies.
  18.  
  19.    Permission is granted to copy and distribute modified versions of
  20. this manual under the conditions for verbatim copying, provided that
  21. the entire resulting derived work is distributed under the terms of a
  22. permission notice identical to this one.
  23.  
  24.    Permission is granted to copy and distribute translations of this
  25. manual into another language, under the above conditions for modified
  26. versions, except that this permission notice may be stated in a
  27. translation approved by the Foundation.
  28.  
  29. 
  30. File: gimpprint.info,  Node: Oversampling,  Prev: What is perfect weaving?,  Up: Weaving algorithms
  31.  
  32. Oversampling
  33. ------------
  34.  
  35.    By oversampling, we mean printing on the same row more than once.
  36. There are two reasons for oversampling: to increase the horizontal
  37. resolution of the printout and to reduce banding.
  38.  
  39.    Oversampling to increase horizontal resolution is necessary because,
  40. although the printer might be able to position an ink drop to, for
  41. example, 1/1440" horizontally, it may not be able to lay down two such
  42. drops 1/1440" apart.  If it can print two drops 1/720" apart, 2x
  43. oversampling will be necessary to get a 1/1440" horizontal resolution.
  44. If it can only print two drops 1/360" apart, 4x oversampling will be
  45. necessary for a 1/1440" horizontal resolution.  The printer enforces
  46. this "drop spacing" by only accepting raster passes with a horizontal
  47. resolution matching the spacing with which it can print dots, so we
  48. must print passes at different horizontal positions if we are to obtain
  49. a higher horizontal resolution.  (Another reason it does this may be to
  50. reduce the amount of memory needed in the printer.)
  51.  
  52.    Oversampling can also be done to decrease the banding apparent in an
  53. image.  By splitting a row into two or more sets of dots ("lines") and
  54. printing each line on the same row, but with a different nozzle for
  55. each line, we can get a smoother print.
  56.  
  57.    To quantify these two kinds of oversampling, we'll introduce two new
  58. constants: H shows how many different horizontal offsets we want to
  59. print at (the "horizontal oversampling") while O shows how many times
  60. we want to print each row, over and above the number of times necessary
  61. for horizontal oversampling (the "extra oversampling").
  62.  
  63.    It is necessary for all the lines printed by a given pass to have the
  64. same horizontal offset, but there need not be any relation between them
  65. in terms of extra oversampling.  For the moment, however, we will treat
  66. all oversampling as potentially requiring this alignment; all lines in
  67. one pass must be derived from the original row data in the same way.
  68. Thus, we'll assume O=1 for now.
  69.  
  70.    So, how do we do this oversampling?  In fact, it can be done easily:
  71. advance the paper by a factor of H less between each pass.  We'll
  72. define a new variable, A, to show how much we advance the paper between
  73. passes.  Previously, we'd have defined A=J; we now let A=J/H.  This
  74. also affects our pass blocks.  Printing one pass block used to involve
  75. advancing the paper S*J rows; it now advances the paper S*J/H rows.  We
  76. therefore name a group of H pass blocks a "band".  Printing one band
  77. involves advancing the paper S*J rows, as a pass block did before.
  78.  
  79.    To keep our weave pattern working correctly, so that overprinting
  80. does not occur within a pass block, we also have to redefine G as
  81. GCD(S,A).  Here's an example of an oversampled weave pattern:
  82.  
  83. S=4, J=10, H=2, A=J/H=10/2=5, G=GCD(4,5)=1,
  84. passesperblock=S=4,
  85. passespersubblock=S/G=4/1=4:
  86.  
  87.      0 *---*---*---*---*---*---*---*---*---*
  88.      1      *---*---*---*---*---*---*---*---*---*
  89.      2           *---*---*---*---*---*---*---*---*---*
  90.      3                *---*---*---*---*---*---*---*---*---*
  91.      4                     *---*---*---*---*---*---*---*---*---*
  92.      5                          *---*---*---*---*---*---*---*---*---*
  93.      6                               *---*---*---*---*---*---*---*---*---*
  94.      7                                    *---*---*---*---*---*---*---*---*---*
  95.      8                                         *---*---*---*---*---*---*---*---*---*
  96.      9                                              *---*---*---*---*---*---*---*---*
  97.      10                                                  *---*---*---*---*---*---*---
  98.      11                                                       *---*---*---*---*---*--
  99.      12                                                            *---*---*---*---*-
  100.      13                                                                 *---*---*---*
  101.      14                                                                      *---*---
  102.      15                                                                           *--
  103.  
  104.    Now we have to determine which line is printed by each jet on each
  105. pass.  If we number each line generated as we split up a row, we can
  106. use these numbers.  We'll number the lines in our diagram by replacing
  107. the `*'s with integers in the range [0...H-1].
  108.  
  109.    Overprinting occurs once per pass block, so we can simply print pass
  110. block 0 with line 0, pass block 1 with line 1, pass block 2 with line
  111. 2, etc, wrapping to 0 when we've run out of lines:
  112.  
  113.      0 0---0---0---0---0---0---0---0---0---0
  114.      1      0---0---0---0---0---0---0---0---0---0
  115.      2           0---0---0---0---0---0---0---0---0---0
  116.      3                0---0---0---0---0---0---0---0---0---0
  117.      4                     1---1---1---1---1---1---1---1---1---1
  118.      5                          1---1---1---1---1---1---1---1---1---1
  119.      6                               1---1---1---1---1---1---1---1---1---1
  120.      7                                    1---1---1---1---1---1---1---1---1---1
  121.      8                                         0---0---0---0---0---0---0---0---0---0
  122.      9                                              0---0---0---0---0---0---0---0---0
  123.      10                                                  0---0---0---0---0---0---0---
  124.      11                                                       0---0---0---0---0---0--
  125.      12                                                            1---1---1---1---1-
  126.      13                                                                 1---1---1---1
  127.      14                                                                      1---1---
  128.      15                                                                           1--
  129.  
  130. S=4,  J=12,  H=2,  A=J/H=12/2=6,  G=GCD(4,6)=2,
  131. passesperblock=S=4,
  132. passespersubblock=S/G=4/2=2:
  133.  
  134.      0 0---0---0---0---0---0---0---0---0---0---0---0
  135.      1       0---0---0---0---0---0---0---0---0---0---0---0
  136.      2              0---0---0---0---0---0---0---0---0---0---0---0
  137.      3                    0---0---0---0---0---0---0---0---0---0---0---0
  138.      4                         1---1---1---1---1---1---1---1---1---1---1---1
  139.      5                               1---1---1---1---1---1---1---1---1---1---1---1
  140.      6                                      1---1---1---1---1---1---1---1---1---1---1
  141.      7                                            1---1---1---1---1---1---1---1---1--
  142.      8                                                 0---0---0---0---0---0---0---0-
  143.      9                                                       0---0---0---0---0---0---
  144.      10                                                             0---0---0---0---0
  145.      11                                                                   0---0---0--
  146.      12                                                                        1---1-
  147.  
  148.    But what do we do if J is not an exact multiple of H?  This is a
  149. difficult problem, which I struggled with for quite a few days before
  150. giving in and taking the easy (but less elegant) way out.  The easy
  151. solution is to round J/H down, then add on the accumulated error at the
  152. end of each band.
  153.  
  154. S=4,  J=11,  H=2  A=floor(J/H)=floor(11/2)=5,  G=GCD(4,5),
  155. passesperblock=S=4,
  156. passespersubblock=S/G=4/1=4
  157.  
  158.      Band 0:
  159.      0 0---0---0---0---0---0---0---0---0---0---0
  160.      1      0---0---0---0---0---0---0---0---0---0---0
  161.      2           0---0---0---0---0---0---0---0---0---0---0
  162.      3                0---0---0---0---0---0---0---0---0---0---0
  163.      4                     1---1---1---1---1---1---1---1---1---1---1
  164.      5                          1---1---1---1---1---1---1---1---1---1---1
  165.      6                               1---1---1---1---1---1---1---1---1---1---1
  166.      7                                    1---1---1---1---1---1---1---1---1---1---
  167.      
  168.      Band 1:
  169.      8 |                                           0---0---0---0---0---0---0---0---0-
  170.      9  \-----------------------------------------/     0---0---0---0---0---0---0---0
  171.      10                   S*J rows                           0---0---0---0---0---0---
  172.      11                                                           0---0---0---0---0--
  173.      12                                                                1---1---1---1-
  174.      13                                                                     1---1---1
  175.      14                                                                          1---
  176.  
  177.    We can calculate the starting row and subpass number of a given pass
  178. in this scheme as follows:
  179.  
  180.      A = floor(J / H)
  181.      subblocksperblock = gcd(S, A)
  182.      subpassblock = floor((p % S) * subblocksperblock / S)
  183.      if subpassblock * 2 < subblocksperblock
  184.          subblockoffset = 2*subpassblock
  185.      else
  186.          subblockoffset = 2*(subblocksperblock-subpassblock)-1
  187.      band = floor(P / (S * H))
  188.      passinband = P % (S * H)
  189.      startingrow = band * S * J + passinband * A + subblockoffset
  190.      subpass = passinband / S
  191.  
  192.    So the row number of jet j of pass p is
  193.  
  194.      A = floor(J / H)
  195.      subblocksperblock = gcd(S, A)
  196.      
  197.      subblockoffset(p)
  198.          = 2*subpassblock       , if subpassblock * 2 < subblocksperblock
  199.          = 2*(subblocksperblock-subpassblock)-1      , otherwise
  200.            where
  201.            subpassblock = floor((p % S) * subblocksperblock / S)
  202.      
  203.      band(p) = floor(p / (S * H))
  204.      passinband(p) = p % (S * H)
  205.      
  206.      row(j, p) = band(p) * S * J + passinband(p) * A + subblockoffset(p) + j * S
  207.      row(j, p) = p * J + subblockoffset(p) + j * S
  208.  
  209.    To be continued....
  210.  
  211. 
  212. File: gimpprint.info,  Node: ESC/P2,  Next: New Printer,  Prev: Weaving,  Up: Appendices
  213.  
  214. ESC/P2
  215. ******
  216.  
  217. * Menu:
  218.  
  219. * ESC/P2 Introduction::                What is ESC/P2
  220. * ESC/P2 Standard Commands::           Normal ESC/P2 commands
  221. * ESC/P2 Remote Mode Commands::        Exotic ESC/P2 commands
  222. * ESC/P2 Appropriate Remote Commands:: Useful remote command sequences
  223.  
  224. 
  225. File: gimpprint.info,  Node: ESC/P2 Introduction,  Next: ESC/P2 Standard Commands,  Up: ESC/P2
  226.  
  227. Introduction to ESC/P2
  228. ======================
  229.  
  230.    This is a description of the ESC/P2 raster commands used by the
  231. gimp-print plugin and Ghostscript driver, which is a subset of the
  232. complete command set.  The full documents are found on
  233. <http://www.ercipd.com/isv/edr_docs.htm>.  Note that these are *not*
  234. always correct, and are certainly not complete.
  235.  
  236.    All ESCP/2 raster commands begin with the `ESC' character (1b hex),
  237. followed by either one or two command characters and arguments where
  238. applicable.  Older commands generally have one command character.  Newer
  239. commands usually have a `(' (left parenthesis) followed by a command
  240. character and a byte count for the arguments that follow.  The byte
  241. count is a 16-bit (2 byte) binary integer, in little endian order.
  242.  
  243.    All arguments listed here are of the form `name[bytes]' where
  244. `[bytes]' is the number of bytes that comprise the argument.  The
  245. arguments themselves are usually one, two, or four byte integers, always
  246. little endian (the least significant bits come first).  Presumably this
  247. is to match Intel processors.
  248.  
  249.    In some cases, the same command sequence identifies different
  250. versions of the same command, depending upon the number of bytes of
  251. arguments.
  252.  
  253. 
  254. File: gimpprint.info,  Node: ESC/P2 Standard Commands,  Next: ESC/P2 Remote Mode Commands,  Prev: ESC/P2 Introduction,  Up: ESC/P2
  255.  
  256. Standard commands
  257. =================
  258.  
  259.  - ESC/P2 command: `ESC @'
  260.      Reset the printer.  Discards any output, ejects the existing page,
  261.      returns all settings to their default.  Always use this before
  262.      printing a page.
  263.  
  264.  - ESC/P2 command: `ESC (G BC=1 ON1'
  265.      Turn on graphics mode.  ON should be `1' (turn on graphics mode).
  266.  
  267.  - ESC/P2 command: `ESC (U BC=1 UNIT1'
  268.      Set basic unit of measurement used by printer.  This is expressed
  269.      in multiples of 1/3600".  At 720 DPI, UNIT is `5'; at 360 DPI,
  270.      UNIT is `10'.
  271.  
  272.  - ESC/P2 command: `ESC (U BC=5 PAGEUNITS1 VUNIT1 HUNIT1 BASEUNIT2'
  273.      Set basic units of measurement used by the printer.  PAGEUNIT is
  274.      the unit of page measurement (for commands that set page
  275.      dimensions and the like).  VUNIT is the unit of vertical
  276.      measurement (for vertical movement commands).  HUNIT is the unit
  277.      of horizontal movement (for horizontal positioning commands).  All
  278.      of these units are expressed in BASEUNIT, which is in reciprocal
  279.      inches.  Typically, BASEUNIT is `1440'.  In 720 DPI mode, PAGEUNIT,
  280.      VUNIT, and HUNIT are all `2'; in 1440x720 DPI mode, PAGEUNIT and
  281.      VUNIT are normally set to `2'; HUNIT is set to `1'.
  282.  
  283.  - ESC/P2 command: `ESC (K BC=2 ZERO1 GRAYMODE1'
  284.      Set color or grayscale mode, on printers supporting an explicit
  285.      grayscale mode.  These printers can be identified because they are
  286.      advertised as having more black nozzles than nozzles of individual
  287.      colors.  Setting grayscale mode allows use of these extra nozzles
  288.      for faster printing.  GRAYMODE should be `0' or `2' for color, `1'
  289.      for grayscale.  ZERO should always be `0'.
  290.  
  291.  - ESC/P2 command: `ESC (i BC=1 MICROWEAVE1'
  292.      If MICROWEAVE is `1', use microweave mode.  On older printers,
  293.      this is used to turn on microweave; on newer printers, it prints
  294.      one row at a time.  All printers support this mode.  It should
  295.      only be used at 720 (or 1440x720) DPI.  The Epson Stylus Pro series
  296.      indicates additional modes:
  297.  
  298.     `2'
  299.           "Full-overlap"
  300.  
  301.     `3'
  302.           "Four-pass"
  303.  
  304.     `4'
  305.           "Full-overlap 2"
  306.  
  307.      Any of these commands can be used with the high four bits set to
  308.      either `3' or `0'.
  309.  
  310.  - ESC/P2 command: `ESC U DIRECTION1'
  311.      If DIRECTION is `1', print unidirectionally; if `0', print
  312.      bidirectionally.
  313.  
  314.  - ESC/P2 command: `ESC (s BC=1 SPEED1'
  315.      On some older printers, this controls the print head speed.  SPEED
  316.      of `2' is 10 inches/sec; SPEED of `0' or 1 is 20.
  317.  
  318.  - ESC/P2 command: `ESC (e BC=2 ZERO1 DOTSIZE1'
  319.      Choose print dotsize.  DOTSIZE can take on various values,
  320.      depending upon the printer.  Almost all printers support `0' and
  321.      `2'.  Variable dot size printers allow a value of 16.  Other than
  322.      the value of 16, this appears to be ignored at resolutions of 720
  323.      DPI and above.
  324.  
  325.  - ESC/P2 command: `ESC (C BC=2 PAGELENGTH2'
  326.  - ESC/P2 command: `ESC (C BC=4 PAGELENGTH4'
  327.      Set the length of the page in "pageunits" (see `ESC (U' above).
  328.      The second form of the command allows setting of longer page
  329.      lengths on new printers (these happen to be the printers that
  330.      support variable dot size).
  331.  
  332.  - ESC/P2 command: `ESC (c BC=4 TOP2 LENGTH2'
  333.  - ESC/P2 command: `ESC (c BC=8 TOP4 LENGTH4'
  334.      Set the vertical page margins of the page in "pageunits" (see `ESC
  335.      (U' above).  The margins are specified as the top of the page and
  336.      the length of the page.  The second form of the command allows
  337.      setting of longer page lengths on new printers (these happen to be
  338.      the printers that support variable dot size).
  339.  
  340.  - ESC/P2 command: `ESC (S BC=8 WIDTH4 LENGTH4'
  341.      Set the width and length of the printed page region in "pageunits"
  342.      (see `ESC (U' above).
  343.  
  344.  - ESC/P2 command: `ESC (v BC=2 ADVANCE2'
  345.  - ESC/P2 command: `ESC (v BC=4 ADVANCE4'
  346.      Feed vertically ADVANCE "vertical units" (see `ESC (U' above) from
  347.      the current print head position.
  348.  
  349.  - ESC/P2 command: `ESC (V BC=2 ADVANCE2'
  350.  - ESC/P2 command: `ESC (V BC=4 ADVANCE4'
  351.      Feed vertically ADVANCE "vertical units" (see `ESC (U' above) from
  352.      the top margin.
  353.  
  354.  - ESC/P2 command: `ESC ($ BC=4 OFFSET4'
  355.      Set horizontal position to OFFSET from the left margin.  This
  356.      command operates on printers of the 740 class and newer (all
  357.      printers with variable dot size).
  358.  
  359.  - ESC/P2 command: `ESC $ OFFSET2'
  360.      Set horizontal position to OFFSET from the left margin.  This
  361.      command operates on printers of the 740 class and newer (all
  362.      printers with variable dot size).
  363.  
  364.  - ESC/P2 command: `ESC (\ BC=4 UNITS2 OFFSET2'
  365.      Set horizontal position to OFFSET from the previous print head
  366.      position, measured in UNITS.  UNITS is measured in inverse inches,
  367.      and should be set to 1440 in all cases.  This operates on all 1440
  368.      dpi printers that do not support variable dot size.
  369.  
  370.  - ESC/P2 command: `ESC (/ BC=4 OFFSET4'
  371.      Set horizontal position to OFFSET from the previous print head
  372.      position, measured in "horizontal units" (see `ESC (U' above).
  373.      This operates on all variable dot size printers.
  374.  
  375.  - ESC/P2 command: `ESC \ OFFSET2'
  376.      Set horizontal position to OFFSET from the previous print head
  377.      position, measured in basic unit of measurement (see `ESC (U'
  378.      above). This is used on all 720 dpi printers, and can also be used
  379.      on 1440 dpi printers in lower resolutions to save a few bytes.
  380.      Note that OFFSET may be negative.  The range of values for this
  381.      command is between `-16384' and `16383'.
  382.  
  383.  - ESC/P2 command: `ESC r COLOR1'
  384.  - ESC/P2 command: `ESC (r BC=2 DENSITY1 COLOR1'
  385.      Set the ink color.  The first form is used on four-color printers;
  386.      the second on six-color printers.  DENSITY is `0' for dark inks,
  387.      `1' for light.  COLOR is
  388.  
  389.     `0'
  390.           black
  391.  
  392.     `1'
  393.           magenta
  394.  
  395.     `2'
  396.           cyan
  397.  
  398.     `4'
  399.           yellow
  400.  
  401.      This command is not used on variable dot size printers in softweave
  402.      mode.
  403.  
  404.  - ESC/P2 command: `ESC . COMPRESS1 VSEP1 HSEP1 LINES1 WIDTH2 DATA...'
  405.          Print data.  COMPRESS signifies the compression mode:
  406.  
  407.     `0'
  408.           no compression
  409.  
  410.     `1'
  411.           TIFF compression (incorrectly documented as "run length
  412.           encoded")
  413.  
  414.     `2'
  415.           TIFF compression with a special command set.
  416.  
  417.      VSEP depends upon resolution and printer type.  At 360 DPI, it is
  418.      always `10'.  At 720 DPI, it is normally `5'5.  On the ESC 600, it
  419.      is `40' (8 * 5).  On some other printers, it varies.
  420.  
  421.      HSEP1 is `10' at 360 DPI and `5' at 720 or 1440 DPI (1440 DPI
  422.      cannot be printed in one pass; it is printed in two passes, with
  423.      the dots separated in each pass by 1/720").
  424.  
  425.      LINES is the number of lines to be printed.  It should be `1' in
  426.      microweave and 360 DPI.  At 720 DPI softweave, it should be the
  427.      number of lines to be actually printed.
  428.  
  429.      WIDTH is the number of pixels to be printed in each row.
  430.      Following this command, a carriage return (`13' decimal, `0A' hex)
  431.      should be output to return the print head position to the left
  432.      margin.
  433.  
  434.      The basic data format is a string of bytes, with data from left to
  435.      right on the page.  Within each byte, the highest bit is first.
  436.  
  437.      The TIFF compression is implemented as one count byte followed by
  438.      one or more data bytes.  There are two cases:
  439.  
  440.        1. If the count byte is `128' or less, it is followed by [count]
  441.           + 1 data bytes.  So if the count byte is `0', it is followed
  442.           by 1 data byte; if it is `128', it is followed by 129 data
  443.           bytes.
  444.  
  445.        2. If the count byte is greater than 128, it is followed by one
  446.           byte.  This byte is repeated (257 - [count]) times.  So if
  447.           [count] is 129, the next byte is treated as though it were
  448.           repeated 128 times; if [count] is 255, it is treated as
  449.           though it were repeated twice.
  450.  
  451.  - ESC/P2 command: `ESC i COLOR1 COMPRESS1 BITS1 BYTES2 LINES2 DATA...'
  452.      Print data in the newer printers (that support variable dot size),
  453.      and Stylus Pro models.
  454.  
  455.      COLOR is the color:
  456.  
  457.     `0'
  458.           black
  459.  
  460.     `1'
  461.           magenta
  462.  
  463.     `2'
  464.           cyan
  465.  
  466.     `4'
  467.           yellow
  468.  
  469.     `17'
  470.           light magenta
  471.  
  472.     `18'
  473.           light cyan
  474.  
  475.      COMPRESS signifies the compression mode:
  476.  
  477.     `0'
  478.           no compression
  479.  
  480.     `1'
  481.           TIFF compression (incorrectly documented as "run length
  482.           encoded")
  483.  
  484.     `2'
  485.           TIFF compression with a special command set.
  486.  
  487.      BITS is the number of bits per pixel.
  488.  
  489.      BYTES is the number of bytes wide for each row (ceiling(BITS *
  490.      width_of_row, 8)). Note that this is different from the `ESC .'
  491.      command above.
  492.  
  493.      LINES is the number of lines to be printed.  This command is the
  494.      only way to get variable dot size printing.  In variable dot mode,
  495.      the size of the dots increases as the value (`1', `2', or `3')
  496.      increases.
  497.  
  498.  - ESC/P2 command: `ESC (D BC=4 BASE2 VERTICAL1 HORIZONTAL1'
  499.      Set printer horizontal and vertical spacing.  It only applies to
  500.      variable dot size printers in softweave mode (and possibly other
  501.      high end printers).
  502.  
  503.      BASE is the base unit for this command; it must be `14400'.
  504.  
  505.      VERTICAL is the distance in these units between printed rows; it
  506.      should be (separation_in_nozzles * BASE / 720).
  507.  
  508.      HORIZONTAL is the horizontal separation between dots in a row.
  509.      Depending upon the printer, this should be either (14400 / 720) or
  510.      (14400 / 360).  The Stylus Pro 9000 manual suggests that the
  511.      settings should match the chosen resolution, but that is
  512.      apparently not the case (or not always the case) on other printers.
  513.  
  514.  - ESC/P2 command: `ESC (R BC=8 00 R E M O T E 1'
  515.      Enters "remote mode".  This is a special, undocumented command set
  516.      that is used to set up various printer options, such as paper feed
  517.      tray, and perform utility functions such as head cleaning and
  518.      alignment.  It does not appear that anything here is actually
  519.      required to make the printer print.  Our best understanding of
  520.      what is in a remote command sequence is described in a separate
  521.      section below.
  522.  
  523.  - ESC/P2 command: `ESC 01 @EJL [sp] ID\r\n'
  524.      Return the printer ID.  This is considered a remote mode command,
  525.      although the syntax is that of a conventional command.  This
  526.      returns the following information:
  527.  
  528.           @EJL ID\r
  529.           MFG:EPSON;
  530.           CMD:ESCPL2,BDC;
  531.           MDL:[printer model];
  532.           CLS:PRINTER;
  533.           DES:EPSON [printer model];
  534.           \f
  535.  
  536.    After all data has been sent, a form feed byte should be sent.
  537.  
  538.    All newer Epson printers (STC 440, STP 750) require the following
  539. command to be sent at least once to enable printing at all.  This
  540. command specifically takes the printer out of the Epson packet mode
  541. communication protocol (whatever that is) and enables normal data
  542. transfer.  Sending it multiple times is is not harmful, so it is
  543. normally sent at the beginning of each job:
  544.  
  545.      ESC 01@EJL[space]1284.4[newline]@EJL[space][space][space][space]
  546.      [space][newline]ESC@
  547.  
  548.    The proper sequence of initialization commands is:
  549.  
  550.      magic command
  551.      ESC  remote mode if needed
  552.      ESC (G
  553.      ESC (U
  554.      ESC (K (if appropriate)
  555.      ESC (i
  556.      ESC U (if needed)
  557.      ESC (s (if appropriate)
  558.      ESC (e
  559.      ESC (C
  560.      ESC (c
  561.      ESC (S
  562.      ESC (D (if needed)
  563.      ESC (V (optional -- this can be accomplished with ESC (v)
  564.  
  565.    For printing, the proper sequence is:
  566.  
  567.      ESC (v
  568.  
  569. and repeat for each color:
  570.  
  571.      ESC ($ or ESC (\ or ESC \
  572.      ESC (r or ESC r (if needed--not used with `ESC i' and not needed if the color
  573.      has not changed from the previous printed line)
  574.      ESC . or ESC i  ...data... [return] (0A hex)
  575.  
  576.    To terminate a page:
  577.  
  578.      [formfeed] (0C hex)
  579.      ESC @
  580.  
  581. 
  582. File: gimpprint.info,  Node: ESC/P2 Remote Mode Commands,  Next: ESC/P2 Appropriate Remote Commands,  Prev: ESC/P2 Standard Commands,  Up: ESC/P2
  583.  
  584. Remote Mode Commands
  585. ====================
  586.  
  587.    The following description of remote commands comes out of an
  588. examination of the sequences used by the printer utilities bundled with
  589. the Windows drivers for the ESC740, and from other sources (some Epson
  590. manuals, experimentation, analysis of print files).  It is largely
  591. speculative as these commands are not all documented in the Epson
  592. documentation we have access to.  Generally, newer manuals provide more
  593. thorough documentation.
  594.  
  595.    Remote command mode is entered when the printer is sent the following
  596. sequence:
  597.  
  598.      ESC (R BC=8 00 R E M O T E 1
  599.  
  600.    Remote mode commands are then sent, and terminated with the following
  601. sequence:
  602.  
  603.      ESC 00 00 00
  604.  
  605.    All remote mode commands must be sent before the initial `ESC (G'
  606. command is sent.
  607.  
  608.    This introductory sequence is then followed by a sequence of
  609. commands.  Each command is constructed as follows:
  610.  
  611.    * Two ASCII bytes indicating the function
  612.  
  613.    * A byte count (two bytes, little-endian) for the parameters
  614.  
  615.    * Binary parameters, if any
  616.  
  617.    This is a list of all remote commands we have seen:
  618.  
  619.  - ESC/P2 remote command: `NC BC=2 00 00'
  620.      Print a nozzle check pattern
  621.  
  622.  - ESC/P2 remote command: `VI BC=2 00 00'
  623.      on my 740, prints the following:
  624.  
  625.           W01286 I02382\r\n
  626.  
  627.      probably "version information"
  628.  
  629.  - ESC/P2 remote command: `* AI BC=3 00 00 00'
  630.      Prints a "printer ID".  On one 870, prints the following:
  631.           51-51-50-51-49-48\r\n
  632.  
  633.      The Windows driver has a text entry field where this number can be
  634.      entered, but its purpose is unknown.
  635.  
  636.  - ESC/P2 remote command: `* LD BC=0'
  637.      Load printer defaults from NVRAM, DIP switches, and/or ROM. This
  638.      apparently does not load factory defaults per se, but any settings
  639.      that are saved.  This is commonly used right at the end of each
  640.      print job after the `ESC @' printer reset command.
  641.  
  642.  - ESC/P2 remote command: `* CH BC=2 00 XX'
  643.      Perform a head cleaning cycle.  The heads to clean are determined
  644.      by parameter XX:
  645.  
  646.     `00'
  647.           clean all heads
  648.  
  649.     `01'
  650.           clean black head
  651.  
  652.     `02'
  653.           clean color heads
  654.  
  655.      While XX = `00' is probably supported by all printers, XX = `01'
  656.      and `02' may well not be.
  657.  
  658.  - ESC/P2 remote command: `* DT BC=3 00 XX 00'
  659.      Print an alignment pattern.  There are three patterns, which are
  660.      picked via the choice of XX.  Pattern `0' is coarse, pattern `1'
  661.      is medium, and pattern `2' is fine.
  662.  
  663.  - ESC/P2 remote command: `* DU BC=6 00 XX 00 09 00 YY'
  664.      Print another alignment pattern.  It isn't entirely clear what XX
  665.      and YY are, but it appears that XX takes on the values `1' and `2'
  666.      , and YY takes on the values `0' and 1.  This may only work on the
  667.      580 and/or 480.
  668.  
  669.  - ESC/P2 remote command: `* DA BC=4 00 XX 00 YY'
  670.      Set results for the first alignment pattern.  XX is the pattern
  671.      (`1'-`3'); YY is the best choice from the set (`1'-`7' or
  672.      `1'-`15').  This does not save to NVRAM, so when the printer is
  673.      powered off, the setting will be lost.
  674.  
  675.  - ESC/P2 remote command: `* DA BC=6 00 XX 00 YY 09 00'
  676.      Set results for alternate alignment pattern.  XX appears to be the
  677.      pass, and YY appears to be the optimum pattern.  This does not
  678.      save to NVRAM, so when the printer is powered off, the setting
  679.      will be lost.
  680.  
  681.  - ESC/P2 remote command: `* SV BC=0'
  682.      Save the current settings to NVRAM.
  683.  
  684.  - ESC/P2 remote command: `* RS BC=1 01'
  685.      Reset the printer.
  686.  
  687.  - ESC/P2 remote command: `* IQ BC=1 01'
  688.      Get ink quantity.  This requires direct access to the printer
  689.      port.  The return looks like
  690.  
  691.           IQ:KKCCMMYY
  692.  
  693.      or
  694.  
  695.           IQ:KKCCMMYYccmm
  696.  
  697.      (for 4-color and 6-color printers respectively), where each pair of
  698.      digits are hexadecimal representations of percent.
  699.  
  700.    The following two commands have been observed on an STP 870.
  701.  
  702.  - ESC/P2 remote command: `* IR BC=2 00 XX'
  703.      *Function unknown*. This command has been observed on an STP 870
  704.      with XX=`03' at the start of a job and XX=`02' at the end of a job
  705.      (where it is followed by an `LD' command).  When in roll mode, the
  706.      values change to XX=`01' at the start of a job and XX=`00' at the
  707.      end of a job.
  708.  
  709.  - ESC/P2 remote command: `* FP BC=3 00 XX YY'
  710.      XX=`00' and YY=`00' selects the printer's normal left margin
  711.      (about 3mm).  XX=`0xb0' and YY=`0xff' selects zero-margin mode,
  712.      where the left-most print position is shifted to a point about
  713.      0.1" to the left of the left-hand edge of the paper, allowing
  714.      printing up to (and off) the left-hand edge of the paper.
  715.  
  716.    The commands below are partially documented in the Stylus Pro 9000
  717. manual.  Much of this information is interpreted; none is tested.
  718.  
  719.  - ESC/P2 remote command: `* SN BC=3 00 XX YY'
  720.      Select Mechanism Sequence.  XX controls which sub-operation is
  721.      performed.  XX=`00' selects the "Feed paper sequence setting".  YY
  722.      can take on the following values (on the STP 870, at any rate):
  723.  
  724.     `0'
  725.           default
  726.  
  727.     `1'
  728.           plain paper
  729.  
  730.     `2'
  731.           postcards
  732.  
  733.     `3'
  734.           film (photo quality glossy film, transparencies)
  735.  
  736.     `4'
  737.           envelopes
  738.  
  739.     `5'
  740.           plain paper (fast load)
  741.  
  742.     `6'
  743.           back light film (although this has been observed with
  744.           heavyweight matte paper)
  745.  
  746.     `7'
  747.           matte paper (observed with 360 dpi inkjet paper, and photo
  748.           quality inkjet paper)
  749.  
  750.     `8'
  751.           photo paper
  752.  
  753.      Experimentation suggests that this setting changes details of how
  754.      the printers' cut sheet feeder works, presumably to tune it for
  755.      different types of paper.
  756.  
  757.      XX=`01' controls the platen gap setting; YY=`00' is the default,
  758.      YY=`1' or `2' are higher settings.
  759.  
  760.      XX=`02' controls paper loading speed (YY=`0' is normal, `1' is
  761.      fast, `2' is slow).  It appears that `1' is used when printing on
  762.      "plain paper", "360dpi ink jet paper" or "ink jet transparencies",
  763.      and YY=`00' for all other paper type settings.
  764.  
  765.      XX=`07' controls duplex printing for printers with that capability
  766.      (YY=0 is default, for non-duplex printing; `1' is front side of
  767.      the paper, and 2 is back side).
  768.  
  769.      XX=`09' controls zero margin printing on the printers with the
  770.      capability of printing zero-margin on all sides (Stylus Photo
  771.      780/790, 890, and 1280/1290).  YY=`0' is the default; `1' enables
  772.      zero margin printing.
  773.  
  774.  - ESC/P2 remote command: `* PP BC=3 00 XX YY'
  775.      Set Paper Path.  XX=`2' indicates manual feed, XX=`3' is for roll
  776.      paper.  YY selects "paper path number".
  777.  
  778.  - ESC/P2 remote command: `* AC BC=2 00 XX'
  779.      Set Auto Cutting State.  XX=`0' selects auto cutting off, XX=`1'
  780.      selects auto cutting on, and XX=`2' indicates horizontal print
  781.      page line on.  It appears that with auto cutting on, roll paper is
  782.      cut automatically at the point a formfeed character is sent.  The
  783.      formfeed character is normally used to eject a page; with this
  784.      turned on, it also cuts the roll paper.  Horizontal print page
  785.      line on prints a narrow line of black dots at the position the
  786.      paper should be cut manually.
  787.  
  788.  - ESC/P2 remote command: `* DR BC=4 00 xx DT2'
  789.      Set Drying Time.  XX=`00' sets the drying time "per scan" (per
  790.      pass?); XX=`01' sets the drying time per page. DT indicates the
  791.      drying time, which is in seconds if page mode is used and in
  792.      milliseconds if scan mode is used.  DT must not exceed 3600
  793.      seconds in per-page mode and 10000 milliseconds in per-scan mode.
  794.  
  795.  - ESC/P2 remote command: `* IK BC=2 00 XX'
  796.      Select Ink Type.  XX=`00' selects dye ink.  Pigment ink is
  797.      apparently selected by XX=`01'.  This probably does not apply to
  798.      the consumer-grade printers.
  799.  
  800.  - ESC/P2 remote command: `* PZ BC=2 00 xx'
  801.      Set Pause After Printing.  XX=`00' selects no pause after
  802.      printing; XX=`01' selects pause after printing.  If turned on, the
  803.      printer is paused after the page is ejected (by the FF byte).  If
  804.      cutting is turned on, the printer is paused *after* the cutting or
  805.      printing of the horizontal cut line.
  806.  
  807.  - ESC/P2 remote command: `* EX BC=6 00 00 00 00 0x14 XX'
  808.      Set Vertical Print Page Line Mode.  XX=`00' is off, XX=`01' is on.
  809.      If turned on, this prints vertical trim lines at the left and
  810.      right margins.
  811.  
  812.  - ESC/P2 remote command: `* EX BC=6 00 00 00 00 0x05 XX'
  813.      Set Roll Paper Mode.  If XX is `0', roll paper mode is off; if XX
  814.      is `1', roll paper mode is on.
  815.  
  816.  - ESC/P2 remote command: `* EX BC=3 00 XX YY'
  817.      Appears to be a synonym for the `SN' command described above.
  818.  
  819.  - ESC/P2 remote command: `* PH BC=2 00 XX'
  820.      Select Paper Thickness.  Set the paper thickness XX in .1 mm
  821.      units.  This must not exceed 0x10 (1.6 mm).  If the thickness is
  822.      set "more than" .6 mm (which probably means "at least" .6 mm,
  823.      since the other case reads "less than 0.5 mm"), the platen gap is
  824.      set high irrespective of the `SN' command.
  825.  
  826.  - ESC/P2 remote command: `* PM BC=2 00 00'
  827.      *Function unknown*. Used on the STC 3000 at least when using roll
  828.      feed, and on the STP 870 in all print files analysed to date.
  829.  
  830.  - ESC/P2 remote command: `* ST BC=2 00 XX'
  831.      Epson's STP 750/1200 programming guide refers to the `ST' command
  832.      as "Set printer state reply".  If XX is `0' or `2', the printer
  833.      will not send status replies.  If XX is `1' or `3', the printer
  834.      will send status replies.  The status replies consist of state,
  835.      error codes, ink leve, firmware version, and warning status.
  836.  
  837.      The actual reply is documented as
  838.  
  839.           @BDC ST\r
  840.           ST: xx;
  841.           [ER: yy;]
  842.           IQ: n1n2n3n4;
  843.           [WR: w1,w2...;]
  844.           RV: zz;
  845.           AI:CW:02kkccmmyy, MI:mm
  846.           [TC:tttt;]
  847.           INK:...;
  848.           \f
  849.  
  850.      (`\r' is carriage return; `\n' is newline; `\f' is formfeed.)
  851.  
  852.      `ST' is the printer status:
  853.  
  854.     `00'
  855.           Error
  856.  
  857.     `01'
  858.           Self-test
  859.  
  860.     `02'
  861.           Busy
  862.  
  863.     `03'
  864.           Waiting while printing
  865.  
  866.     `04'
  867.           Idle
  868.  
  869.     `07'
  870.           Cleaning/filling ink heads
  871.  
  872.     `08'
  873.           Not yet initialized/filling heads
  874.  
  875.      `ER', if provided, is the error status:
  876.  
  877.     `00'
  878.           Fatal error
  879.  
  880.     `01'
  881.           Interface not selected
  882.  
  883.     `04'
  884.           Paper jam
  885.  
  886.     `05'
  887.           Out of ink
  888.  
  889.     `06'
  890.           Paper out
  891.  
  892.      `IQ' is the amount of ink left, as a (decimal!) percentage
  893.      expressed in hexadecimal.  The values are black, cyan, magenta, and
  894.      yellow (presumably 6-color printers supply light cyan and light
  895.      magenta inks as additional parameters).
  896.  
  897.      `WR', if provided, is the warning status:
  898.  
  899.     `10'
  900.           Black ink low
  901.  
  902.     `11'
  903.           Cyan
  904.  
  905.     `12'
  906.           Magenta
  907.  
  908.     `13'
  909.           Yellow
  910.  
  911.     `14'
  912.           Light cyan (presumably)
  913.  
  914.     `15'
  915.           Light magenta (presumably)
  916.  
  917.      `RV' is the firmware revision (one byte ASCII).
  918.  
  919.      `AI' is actuator information.  These are two byte ASCII codes that
  920.      indicate "ink weight rank ID" of KCMY, respectively.
  921.  
  922.      `TC', if provided, is the total time of cleaning or ink filling
  923.      (?).
  924.  
  925.      `INK:' and `MI' are *not documented*.
  926.  
  927.  - ESC/P2 remote command: `* SM BC=2 00 XX'
  928.      Set Status Reply Rate.  XX is the repeat interval in seconds.  If
  929.      XX is `0', the status is returned only when the printer's state
  930.      changes.
  931.  
  932.  - ESC/P2 remote command: `* ST BC=1 01'
  933.      Reply Printer Status.  The reply is formatted as
  934.  
  935.           @BDC PS\r\nST:XX;\f
  936.  
  937.      (`\r' is carriage return; `\n' is newline; `\f' is formfeed).  If
  938.      XX (the reply value) is `0' or `2', automatic status update is
  939.      disabled; if `1' or `3', it is enabled.
  940.  
  941.  - ESC/P2 remote command: `* SM BC=1 01'
  942.      Reply Printer Status Rate.  The reply is formatted as
  943.  
  944.           @BDC PS\r\nST:xx;\f
  945.  
  946.      (`\r' is carriage return; `\n' is newline; `\f' is formfeed).  See
  947.      `SM BC=2' above for the meaning of the return value.
  948.  
  949.  - ESC/P2 remote command: `* ?? BC=XX Y[1] ... Y[xx]'
  950.      Echo Parameters (perhaps better described as Echo Commands).  The
  951.      command string is executed (it would appear from the
  952.      documentation), and the string sent is returned using a sequence
  953.      similar to that described in the `ST BC=1' and `SM BC=1' commands.
  954.      Note that in this case the number of bytes is variable!
  955.  
  956.  - ESC/P2 remote command: `* SM BC=2 00 02'
  957.      *Function unknown*.  Used on the STC 3000 at least when using roll
  958.      feed.
  959.  
  960. 
  961. File: gimpprint.info,  Node: ESC/P2 Appropriate Remote Commands,  Prev: ESC/P2 Remote Mode Commands,  Up: ESC/P2
  962.  
  963. Appropriate Remote Commands
  964. ===========================
  965.  
  966.    All of the remote commands described above are wrapped up with the
  967. usual boilerplate.  The files always start with `00 00 00' and the
  968. "magic" command described above, then two `ESC @'s to reset the
  969. printer.  The remote command sequences come next; if they print anything
  970. that is usually followed by a `FF' (0C hex) character to feed the page,
  971. then the file ends with another two `ESC @'s to get back to the ground
  972. state.
  973.  
  974.    An alignment sequence goes like this:
  975.  
  976.   1. Host uses `DT' to print an alignment sheet
  977.  
  978.   2. User eyeballs the sheet to see which is the best aligned pattern.
  979.  
  980.   3. Host sends a `DA' command indicating which pattern the user chose
  981.  
  982.   4. If the user said "realign", meaning he isn't done yet, go to step 1
  983.  
  984.   5. We are done: host sends a `SV' command and exits
  985.  
  986.    The sequence used (by the STC 3000, at least) to print from the roll
  987. feed is (with byte count omitted)
  988.  
  989.           PM 00 00
  990.           SN 00 00 00
  991.           EX 00 00 00 00 05 01
  992.           ST 00 01
  993.           SM 00 02
  994.  
  995.    The sequence used by the STP 870 to print on plain paper is
  996.  
  997.           PM 00 00
  998.           IR 00 03
  999.           SN 00 00 01
  1000.           SN 00 01 00
  1001.           SN 00 02 01
  1002.           EX 00 00 00 00 05 00
  1003.           FP 00 00 00
  1004.  
  1005. and the job finishes with
  1006.  
  1007.           IR 00 02
  1008.           LD
  1009.  
  1010.    For different paper type settings on the STP 870, the arguments to
  1011. `SN' vary.  The arguments to the first and third `SN' commands are as
  1012. outlined in the description of the `SN' command above; the arguments to
  1013. the second ("platen gap") are `00 01 01' for thick papers ("matte
  1014. paper--heavyweight", "photo paper" and "premium glossy photo paper")
  1015. and `00 01 00' for all others.
  1016.  
  1017.    For roll-mode printing, the STP 870's sequence changes as follows.
  1018. `IR''s arguments become `00 01' in the header, and `00 00' after the
  1019. job, and `EX''s last argument changes from `00' to `01'.
  1020.  
  1021.    For zero-margin printing on the STP 870, the arguments to `FP' become
  1022. `00 0xb0 0xff'.  This moves the origin about 5.5mm to the left, to a
  1023. point one tenth of an inch to the left of the left-hand edge of the
  1024. paper, allowing printing right up to (and beyond) the edge of the
  1025. paper.  Some printers (at least the STP 870) include white absorbent
  1026. pads at the left margin position and other positions (89mm and 100mm on
  1027. the STP 870) to soak up ink which misses the edge of the paper.
  1028. Printing off the edge of paper of a width not aligned with a pad could
  1029. result in making a mess of the inside of the printer and ink getting on
  1030. the reverse of the paper.
  1031.  
  1032. 
  1033. File: gimpprint.info,  Node: New Printer,  Prev: ESC/P2,  Up: Appendices
  1034.  
  1035. Adding a new printer
  1036. ********************
  1037.  
  1038.    This appendix covers adding a new ESCP/2, PCL, or Canon printer.
  1039. Writing a new driver module is not covered.
  1040.  
  1041.    The three steps to adding a printer are:
  1042.  
  1043.   1. Add an entry to `printers.xml'
  1044.  
  1045.   2. Add the appropriate code and data to the appropriate driver module
  1046.  
  1047.   3. Tune the printer
  1048.  
  1049.    Printer information is stored in two places: in `printers.xml'
  1050. (which contains the list of printer models available to the the
  1051. upper-level application), and in the appropriate driver file
  1052. (`print-escp2.c', `print-pcl.c', or `print-canon.c').
  1053.  
  1054. * Menu:
  1055.  
  1056. * printers.xml::                File format description.
  1057. * Driver file::                 Data structures to use.
  1058. * Epson inkjet printers::       Adding an Epson printer.
  1059. * Tuning Epson printers::       Tweaking settings.
  1060. * Canon inkjet printers::       Adding a Canon printer.
  1061.  
  1062. 
  1063. File: gimpprint.info,  Node: printers.xml,  Next: Driver file,  Up: New Printer
  1064.  
  1065. `printers.xml'
  1066. ==============
  1067.  
  1068.    `printers.xml' is an XML-like file (there's no formal DTD) that
  1069. contains very simple printer definitions.  A typical definition follows:
  1070.  
  1071.      <printer name="EPSON Stylus Color 1500" driver="escp2-1500">
  1072.      <color>
  1073.      <model value=2>
  1074.      <gamma value=0.597>
  1075.      <density value=1.0>
  1076.      <language value=escp2>
  1077.      </printer>
  1078.  
  1079.    There are other tags that may be present.  The only ones that are
  1080. mandatory are `<printer>', `<color>', `<model>', and `<language>'.  The
  1081. other optional parameters (gamma and density in this case) can be used
  1082. to adjust control settings.  This is probably not the right place for
  1083. them; the printer drivers themselves should contain this information.
  1084. There's probably no good reason for anything but gamma and density to
  1085. be in here.  Gamma refers to the printer's gamma factor; density is the
  1086. desired base ink density for the printer.  The Epson driver contains
  1087. the density information for each printer at each resolution internally.
  1088. An even better driver would adjust density and possibly even gamma for
  1089. paper type.  All the more reason not to have that information here.
  1090.  
  1091.    If you really are curious about what tags are permitted, please see
  1092. `printdefl.l'.  I deliberately want to make this obscure.
  1093.  
  1094.    Anyway, here's the definition of the tags that do matter:
  1095.  
  1096.  - `printers.xml' tag: `<printer name="LONGNAME" driver="DRIVERNAME">'
  1097.      This starts the definition of a printer.  The LONGNAME should be
  1098.      something human readable; the DRIVERNAME should consist of
  1099.      alphanumerics and hyphens, and be fairly short.  The LONGNAME is
  1100.      what will appear in the GUI listing of printers; the DRIVERNAME is
  1101.      what is actually used to key into the list of printers.  It is
  1102.      legal to have multiple printers with the same driver name.
  1103.  
  1104.  - `printers.xml' tag: `<color>'
  1105.  - `printers.xml' tag: `<nocolor>'
  1106.      Indicates that this printer is capable of color, or is not capable
  1107.      of color respectively
  1108.  
  1109.  - `printers.xml' tag: `<model value=INT>'
  1110.      This defines a model number.  This is passed into the driver,
  1111.      which may do whatever it cares to with it--index into a table,
  1112.      compute on, or whatever.  This need not be unique.
  1113.  
  1114.  - `printers.xml' tag: `<language value=TYPE>'
  1115.      This defines what driver module this printer uses.  TYPE should be
  1116.      `escp2', `pcl', `canon', or `ps'.
  1117.  
  1118.  - `printers.xml' tag: `</printer>'
  1119.      This, of course, closes off a printer definition.
  1120.  
  1121.    This is handled very ad-hoc.  It's ugly.  But it's reasonably easy to
  1122. extend, and it's buzzword-compliant.
  1123.  
  1124. 
  1125. File: gimpprint.info,  Node: Driver file,  Next: Epson inkjet printers,  Prev: printers.xml,  Up: New Printer
  1126.  
  1127. The driver file
  1128. ===============
  1129.  
  1130.    Adding a new printer to a driver module (`print-escp2.c',
  1131. `print-pcl.c', or `print-canon.c'--`print-ps.c' is really ad hoc)
  1132. requires a bit more planning.  Each driver is somewhat different, but
  1133. they all generally have a vector of printer definitions, and the code
  1134. does some special casing based on particular printer capabilities.  The
  1135. PCL and Canon drivers are quite similar; the Canon driver was actually
  1136. cribbed from the PCL driver, but it then returned the favor.
  1137.  
  1138.    The Epson driver is a little bit different.  Canon and PCL printers
  1139. have some amount of intelligence; a lot of them have specific ink
  1140. options, and know about specific paper sizes and types, and must be
  1141. told the right thing.  Epson printers have somewhat less intelligence
  1142. and will more or less do exactly what the host tells it to do in a
  1143. fairly regular fashion.  I actually prefer this; it isn't materially
  1144. more work for the host to compute things like exact paper sizes and
  1145. such, it allows a lot more tweaking, and it may be why Epson has been
  1146. more open with information - the communication protocol doesn't really
  1147. contain very much IP, so they have less reason to keep it secret.
  1148.  
  1149.    Someone else will have to fill in the sections about PCL and Canon
  1150. printers.
  1151.  
  1152.